﻿<UserControl x:Class="WPF_QC.QA_View.MeasurementEntry"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800">
    <Grid ToolTip="">
        <Grid.RowDefinitions>
            <RowDefinition Height="16"/>
            <RowDefinition Height="50"/>
            <RowDefinition />
        </Grid.RowDefinitions>
     

        <DataGrid x:Name="materialtomeasure_dg"  
                  AutoGenerateColumns="False" DataContext="DataTable" 
                  CanUserAddRows="False"
                  CanUserDeleteRows="False"

                  HorizontalAlignment="Left" Margin="27,97.4,0,0" VerticalAlignment="Top" 
                  Height="187" Width="720" Grid.Row="2" ToolTip="Measurement must be decimal">

         
            <DataGrid.RowStyle>
               

                <Style TargetType="DataGridRow">
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="LightGray"/>
                        </Trigger>
                      
                        <Trigger Property="Validation.HasError" Value="true">
                            <Setter Property="ToolTip"
                             Value="{Binding RelativeSource={RelativeSource Self},
                            Path=(Validation.Errors)[0].ErrorContent}"/>
                        </Trigger>

                    </Style.Triggers>
                </Style>
            </DataGrid.RowStyle>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Scheduled Date" Binding="{Binding ScheduledDate, Mode=TwoWay}" IsReadOnly="True"/>
                <DataGridTextColumn Header="Order" Binding="{Binding OrderID, Mode=TwoWay}" IsReadOnly="True"/>
                <DataGridTextColumn Header="Material ID" Binding="{Binding MaterialID, Mode=TwoWay}" IsReadOnly="True"/>
                <DataGridTextColumn Header="Material Name" Binding="{Binding MaterialName, Mode=TwoWay}" IsReadOnly="True"/>
                <DataGridTextColumn Header="Measurement Attribute" Binding="{Binding QCAttribName, Mode=TwoWay}" IsReadOnly="True"/>
                <DataGridTextColumn Header="Enter Measurement" Binding="{Binding EnterMeasurement, Mode=TwoWay, ValidatesOnExceptions=True}"/>
                    
                
            </DataGrid.Columns>
        </DataGrid>


        <Label x:Name="measRptLabel" FontSize="14" Content="Measurement Entry Form" HorizontalAlignment="Center" VerticalAlignment="Top" Width="186" FontWeight="Bold" Margin="202,10,212,0" Grid.Row="1" Height="26" />
        <Label x:Name="machineNameLabel" Content="Select by Order" HorizontalAlignment="Left" Margin="27,48.4,0,0" Grid.Row="2" VerticalAlignment="Top" Width="101" HorizontalContentAlignment="Right" FontWeight="Bold" Height="30"/>
        <TextBlock x:Name="machineNameTextBlock" HorizontalAlignment="Left" Margin="36,10.4,0,0" Grid.Row="2" TextWrapping="Wrap" VerticalAlignment="Top" Width="459" Height="38"/>
        <TextBlock x:Name="resultsTextBlock" HorizontalAlignment="Left" Margin="125,448.4,0,0" Grid.Row="2" TextWrapping="Wrap" VerticalAlignment="Top" Height="26" Width="332"/>
        <Button x:Name="submitEntryBtn" Content="Submit Measurements" HorizontalAlignment="Left" Margin="572,301.4,0,0" Grid.Row="2" VerticalAlignment="Top" Width="154" Height="20" Click="submitEntryBtn_Click"/>
        <ComboBox x:Name="materialstomeasure_combo" HorizontalAlignment="Left" Margin="27,70.4,0,0" Grid.Row="2" VerticalAlignment="Top" Width="120" SelectionChanged="materialstomeasure_combo_SelectionChanged" Loaded="materialstomeasure_combo_Loaded"/>
        <Label x:Name="machineNameLabel_Copy" Content="Displays all orders running on current day" HorizontalAlignment="Left" Margin="0,27.4,0,0" Grid.Row="2" VerticalAlignment="Top" Width="273" HorizontalContentAlignment="Right" FontWeight="Bold" Height="30"/>

    </Grid>
</UserControl>
